/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.repair.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.repair.dto.ElevatorPrincipalQueryDTO;
import org.springblade.modules.repair.dto.ElevatorQueryDTO;
import org.springblade.modules.repair.dto.SimpleElevatorPlanInfoDTO;
import org.springblade.modules.repair.dto.elevator.ElevatorSearchDTO;
import org.springblade.modules.repair.entity.Elevator;
import org.springblade.modules.repair.entity.MaintainCheckRecord;
import org.springblade.modules.repair.vo.*;
import org.springblade.modules.repair.vo.elevator.ElevatorPartWorkVo;
import org.springblade.modules.repair.vo.elevator.ElevatorPlanVo;
import org.springblade.modules.system.vo.SimpleUserVO;

import java.util.List;
import java.util.Map;

/**
 * 电梯信息 Mapper 接口
 *
 * @author BladeX
 * @since 2021-05-21
 */
public interface ElevatorMapper extends BaseMapper<Elevator> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param elevator
	 * @return
	 */
	List<ElevatorVO> selectElevatorPage(@Param("page") IPage<ElevatorVO> page, @Param("elevator") Elevator elevator);

    List<ListElevatorVO> listElevator(@Param("buildingId") Long buildingId,@Param("elevatorName") String elevatorName);

    ElevatorDetailVO selectElevatorDetail(@Param("elevatorId") Long elevatorId);

    ElevatorVO selectElevByPrivateNum(@Param("privateNum") String privateNum,@Param("elevatorId") Long elevatorId);

    List<ElevatorDetailVO> getElevatorListByUserDid(@Param("queryDTO") ElevatorQueryDTO queryDTO, IPage<ElevatorDetailVO> page);

	List<SimpleUserVO> selectEstateElevatorUser(Long elevatorId);

	/**
	 * 项目-电梯列表
	 * @param buildingId 项目id
	 * @param page 分页信息
	 * @param eleName
	 * @return 分页结果
	 */
    IPage<ElevatorVO> buildingElevatorList(@Param("buildingId") Long buildingId, IPage<Object> page,@Param("eleName") String eleName);

    SimpleElevatorPlanInfoDTO getSimpleElevatorPlanInfo(Long elevatorId);

	/**
	 * copy from maintain_admin project, @lasy
	 * @return elevator principal count result map
	 */
	Map<String, Integer> selectElevatorPrincipalCount();

	/**
	 * copy from maintain_admin project, @lasy
	 * @param queryDTO query dto
	 * @return select result
	 */
	List<ElevatorPrincipalPageVO> selectElevatorPrincipalPage(@Param("queryDTO") ElevatorPrincipalQueryDTO queryDTO);

    List<ElevatorSimpleInfoVO> getElevatorSimpleList(@Param("elevatorIds") List<Long> elevatorIds);


	/**
	 * 获取保养工单列表
	 * @param elevatorSearchDTO 电梯id
	 * @return 数据集
	 */
	@InterceptorIgnore(tenantLine = "on")
	List<ElevatorPlanVo> getPlanListBy(@Param("elevatorSearchDTO") ElevatorSearchDTO elevatorSearchDTO);


	/**
	 * 获取保养工单列表
	 * @param elevatorSearchDTO 电梯id
	 * @return 数据集
	 */
	List<ElevatorPlanVo> getPlanListWx(@Param("elevatorSearchDTO")ElevatorSearchDTO elevatorSearchDTO);


	/**
	 * 获取保养工单列表
	 * @param elevatorSearchDTO 电梯id
	 * @return 数据集
	 */
	List<ElevatorPlanVo> getPlanListKr(@Param("elevatorSearchDTO")ElevatorSearchDTO elevatorSearchDTO);


	/**
	 * 获取保养工单列表
	 * @param elevatorSearchDTO 电梯id
	 * @return 数据集
	 */
	List<ElevatorPlanVo> getPlanListPj(@Param("elevatorSearchDTO")ElevatorSearchDTO elevatorSearchDTO);

	@InterceptorIgnore(tenantLine = "on")
	List<ElevatorPartWorkVo>  getWorkListBy(@Param("elevatorSearchDTO")ElevatorSearchDTO elevatorSearchDTO);

	List<ElevatorPartWorkVo> getWorkListWx(@Param("elevatorSearchDTO")ElevatorSearchDTO elevatorSearchDTO);

	List<ElevatorPartWorkVo> getWorkListPj(@Param("elevatorSearchDTO") ElevatorSearchDTO elevatorSearchDTO);

	List<MaintainCheckRecord>  getWorkImageList(@Param("checkHistoryIds")List<Long> checkHistoryIds);

	/**
	 * 新电梯详情
	 * @param elevatorId 当前电梯id
	 * @return 当前基础信息vo
	 */
    NewElevatorPartVO getNewElevatorPartVO(Long elevatorId);

	/**
	 * 新电梯详情 品牌名称
	 * @param partId 部件id
	 * @return 名称
	 */
	String getPartName(Long partId);

	/**
	 * 通用图片详情页保养
	 * @param planId 当前工单id
	 * @return 结果
	 */
	ElevatorPartWorkVo getWorkListByDetail(Long planId);

	/**
	 * 通用图片详情页维修
	 * @param planId 当前工单id
	 * @return 结果
	 */
	ElevatorPartWorkVo getWorkListWxDetail(Long planId);

	/**
	 * 通用图片详情页配件
	 * @param planId 当前工单id
	 * @return 结果
	 */
	ElevatorPartWorkVo getWorkListPartDetail(Long planId);

	/**
	 * 根据电梯id获取电梯类型
	 * @param elevatorId
	 * @return
	 */
	String getModeNameByElevatorId(Long elevatorId);

	/**
	 * 获取项目下的电梯列表
	 * @param buildingId
	 * @return
	 */
	List<ElevatorSimpleInfoVO> getListByBuildingId(Long buildingId);

//	/**
//	 * 获取未排期的电梯列表
//	 * @param page 分页
//	 * @param planContentStatisticalSearchDTO 查询条件
//	 * @return 数据集
//	 */
//	IPage<PlanContentStatisticalDetailVo> getDisScheduleOfGroupIds(IPage<PlanContentStatisticalDetailVo> page, @Param("planContentStatisticalSearchDTO") PlanContentStatisticalSearchDTO planContentStatisticalSearchDTO );
}
